package com.steve.xfood.config;

import org.aspectj.lang.annotation.Before;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

import javax.websocket.server.ServerEndpoint;

/**
 * WebSocket配置
 * @author steve
 * @date 2020/5/28 14:32
 */
@Configuration
public class WebSocketConfig {

    /**
     * 使用springboot时，使用的是springboot的内置容器
     * 如果要使用websocket，需要注入ServerEndpointExporter
     * @return
     */
    @Bean
    public ServerEndpointExporter serverEndpointExporter() {
        return new ServerEndpointExporter();
    }
}
